import { configTypes, informTypes } from '@globalTypes/global'
import { ipcRenderer } from 'electron'

export function settingSyncTimeConfigStoreEvent(config: configTypes.Config) {
  ipcRenderer.send('sync-time-config-store-setting', config)
}

export function mainSyncTimeConfigStoreEvent(callback: (config: configTypes.Config) => void) {
  ipcRenderer.on('sync-time-config-store-main', (_event, config) => {
    callback(config)
  })
}

export function settingSyncInformStoreEvent(informListStr: string) {
  ipcRenderer.send('sync-time-inform-store-setting', informListStr)
}

export function mainSyncTimeInformStoreEvent(callback: (informList: informTypes.InformItem[]) => void) {
  ipcRenderer.on('sync-time-inform-store-main', (_event, informList) => {
    callback(informList)
  })
}
